package listbyorder.access101_200.test101;

import listbyorder.utils.TreeNode;

/**
 * @author code_yc
 * @version 1.0
 * @date 2020/6/7 9:28
 */
public class Solution1 {

    public boolean isSymmetric(TreeNode root) {
        return getAns(root, root);
    }

    private boolean getAns(TreeNode node1, TreeNode node2) {
        if (node1 == null && node2 == null) return true;
        if (node1 == null || node2 == null) return false;
        if (node1.val != node2.val) return false;
        return getAns(node1.left, node2.right) && getAns(node1.right, node2.left);
    }
}
